<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="com.sailorj.medical.domain.family.Family" %>
<%@ page import="com.sailorj.medical.domain.join_nh.Join_nh" %>
<%@ page import="com.sailorj.medical.domain.area.Area" %>
<%@ include file="/common/base.jsp"%>
<% 
  //实例化AreaDao
  FamilyDao familyDao=new FamilyDao();
  Join_nhDao join_nhDao=new Join_nhDao();
  List<Family> familyList=familyDao.findFamilyList();
  List<Join_nh> familyJoin_nhList=join_nhDao.findFamilyJoin_nhList();
  //实例化AreaDao
  AreaDao areaDao=new AreaDao();
  int[]grades={1,2,3,4,5,6,7,8,9};
  List<Area> areaList=areaDao.findListByGrade(grades);
%>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<base href="<%=basePath%>">

<title>家庭档案信息列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<link rel="stylesheet" href="css/styles.css">
<link rel="stylesheet" href="css/admin.css">

<link rel="stylesheet" href="other/layui/css/layui.css">
<script src="other/layui/layui.all.js"></script>
<script src="js/jquery-1.4.4.min.js"></script>
<script src="js/admin.js"></script>


<script language="javascript" type="text/javascript" src="/js/WdatePicker.js"></script>





<script type="text/javascript">
    function getkey(a) {
        var family_id = document.getElementById("family_id").value;
 		var join_year = document.getElementById("join_year").value;
 		var areacode = document.getElementById("areacode").value;
 		
 		var startTime = document.getElementById("startTime").value;
 		var endTime = document.getElementById("endTime").value;
  a.href = '<%=path%>/biz/Join_nhServlet?m=findByLike&family_id=' + family_id+'&join_year='+join_year+'&areacode='+areacode +'&startTime='+startTime+'&endTime='+endTime;
  }
</script>
</head>
<body>
<form method="post" action="" id="listform">
	<div class="panel admin-panel">
		<div class="panel-head">
			<strong class="icon-reorder">参合缴费登记信息列表</strong>
		</div>
		<div class="padding border-bottom">
			<form name ="searchForm" id="searchForm" action="<%=path%>/biz/Join_nhServlet?m=findByLike" method="post">
				<ul class="search" style="padding-left:10px;">
					<li><a class="button border-green icon-plus-square-o"
						   href="<%=path%>/biz/Join_nhServlet?m=in"> 参合登记</a></li>
					<li>

						<input type="text" placeholder="请输入户主编号" name="family_id" id="family_id"
							   class="input" style="width:190px; line-height:17px;display:inline-block" list="family"/>
						<datalist id="family" class="selectDate" aria-invalid="false">
							<%
								for(Family m:familyList){

							%>
							<option value="<%=m.getFamilycode()%>"><%=m.getFamilyname() %></option>
							<%} %>

						</datalist >
						<input type="text" placeholder="年份" name="join_year" id="join_year"
							   class="input" style="width:80px; line-height:17px;display:inline-block" list="year"/>
						<datalist id="year" class="selectDate" aria-invalid="false">
							<option value="2020"></option>
							<option value="2019"></option>
							<option value="2018"></option>
							<option value="2017"></option>
						</datalist >
						<input type="text" placeholder="请输入行政区域" name="areacode" id="areacode"
							   class="input" style="width:190px; line-height:17px;display:inline-block" list="area"/>
						<datalist id="area" class="selectDate" aria-invalid="false">
							<%
								for(Area m:areaList){

							%>
							<option value="<%=m.getAreacode()%>" ><%=m.getAreaname() %></option>
							<%} %>

						</datalist >

						<div class="layui-inline">
							<label class="layui-form-label">日期</label>
							<div class="layui-input-inline">
								<input type="text" name="startTime" id="startTime" lay-verify="startTime"
									   placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
							</div>
						</div>
						至
						<div class="layui-inline">

							<div class="layui-input-inline">
								<input type="text" name="endTime" id="endTime" lay-verify="endTime"
									   placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
							</div>
						</div>

						<a href="" onclick="getkey(this)"
						   class="button border-main icon-search"
						   onclick="changesearch()"> 搜索</a>

						<a href="<%=path%>/biz/Join_nhServlet?m=outexcel"
						   class="button border-green icon-search" > 导出Excel</a>
					</li>
				</ul>
			</form>
		</div>
		<table class="table table-hover text-center">
			<tr>	<th width="50">序号</th>
				<th width="20" style="text-align:center;">&nbsp;</th>
				<!-- <th>行政区域</th> -->
				<th>参合登记编码</th>
				<th>户主姓名</th>
				<th>参合人身份证号</th>

				<th>参合发票编号</th>
				<th>参合时间</th>
				<th>参合年份</th>
				<th>缴费金额</th>
				<th>行政区域</th>
				<th>登记员</th>
			</tr>
			<%
				String pageNo = request.getParameter("pageNo");
				int p = pageNo == null ? 1 : Integer.parseInt(pageNo);
				Join_nhDao dao = new Join_nhDao();
				String sql = "select * from t_join_nh where 1=1 ORDER BY family_id";
				Object[] params = {};
				Page pageBean = dao.queryOjectsByPage(sql, params, p,
						Constant.ROW);
			%>
			<%
				for (int i = 0; i < pageBean.getDatas().size(); i++) {

					Join_nh  model= (Join_nh) pageBean.getDatas().get(i);

			%>
			<tr>
				<td><%=(i+1) %></td>
				<td><input type="checkbox" name="ids"
						   value="<%=model.getJoin_nh_code()%>" /></td>
				<%-- <td align="center"><%=model.getArea().getAreaname()%></td> --%>
				<td><%=model.getJoin_nh_code() %></td>
				<td><%=model.getFamily().getFamilyname()%></td>
				<td><%=model.getJoin_id_card()%></td>
				<td><%=model.getJoin_invoice_code() %></td>
				<td><%=model.getJoin_time()%></td>
				<td><%=model.getJoin_year()%></td>
				<td><%=model.getMoney() %></td>
				<td><%=model.getArea().getAreaname()%></td>
				<td><%=model.getUser_id()%></td>

				<td></td>
			</tr>
			<%
				}
			%>
		</table>
		<div class="pagelist">
			<%
				if (pageBean.hasPre()) {
			%>
			<a
					href="<%=path%>/biz/FamilyServlet?m=list&pageNo=<%=pageBean.prePage()%>">上一页</a>
			<%
			} else {
			%>
			<a href="javascript:void(0)">上一页</a>
			<%
				}
			%>
			<%
				List<Integer> linkNums = pageBean.linkLumbers();
				for (int num : linkNums) {
					if (pageBean.isCurrent(num)) {
			%>
			<span class="current"><%=num%></span>
			<%
			} else {
			%>
			<a href="<%=path%>/biz/FamilyServlet?m=list&pageNo=<%=num%>"><%=num%></a>
			<%
					}
				}
			%>
			<%
				if (pageBean.hasNext()) {
			%>
			<a
					href="<%=path%>/biz/FamilyServlet?m=list&pageNo=<%=pageBean.lastPage()%>">下一页</a>
			<%
			} else {
			%>
			<a href="javascript:void(0)">下一页</a>
			<%
				}
			%>
			<a
					href="<%=path%>/biz/FamilyServlet?m=list&pageNo=<%=pageBean.getPages()%>">尾页</a>
		</div>
	</div>
</form>
<!-- 以下是时间控件 -->
<script>
	layui.use('laydate', function(){
		var laydate = layui.laydate;

		//执行一个laydate实例
		laydate.render({
			elem: '#startTime' //指定元素
			,value: '${tbPoltVote.votestartTime}'
			,type: 'datetime',
			isInitValue: true
		});
	});
</script>
<script>
	layui.use('laydate', function(){
		var laydate = layui.laydate;

		//执行一个laydate实例
		laydate.render({
			elem: '#endTime' //指定元素
			,value: '${tbPoltVote.voteendTime}'
			,type: 'datetime'
			,isInitValue: true
		});
	});
</script>
</body>
</html>